<!--{template admin/header}-->
<script src="static/js/date/WdatePicker.js" type="text/javascript"></script>
<form method="post" action="admin.php?mod=contest&code=do_create" enctype="multipart/form-data" >
<table cellspacing="1" cellpadding="4" width="100%" align="center" class="tableborder">
	<tr class="header">
		<td colspan="2">创建大赛</td>
	</tr>
	<tr>
		<td class="altbg1" width="15%" bgcolor="#F8F8F8">大赛名字</td>
		<td class="altbg2" width="85%" align="right" bgcolor="#FFFFFF">
			<input type="text" name="data[name]">
		</td>
	</tr>
	<tr>
		<td class="altbg1" width="15%" bgcolor="#F8F8F8">大赛时间</td>
		<td class="altbg2" width="85%" align="right" bgcolor="#FFFFFF">
		<input class="Wdate" type="text" name="time[start_time]" onFocus="WdatePicker({isShowClear:false,readOnly:true})"/>-
		<input class="Wdate" type="text" name="time[end_time]" onFocus="WdatePicker({isShowClear:false,readOnly:true})"/>
		</td>
	</tr>
	<tr>
		<td class="altbg1" width="15%" bgcolor="#F8F8F8">大赛描述</td>
		<td class="altbg2" width="85%" align="right" bgcolor="#FFFFFF">
			<textarea name="data[describe]"></textarea>
		</td>
	</tr>
	<tr>
		<td class="altbg1" width="15%" bgcolor="#F8F8F8">大赛图片</td>
		<td class="altbg2" width="85%" align="right" bgcolor="#FFFFFF">
			<input type="file" name="image">
		</td>
	</tr>
	<tr>
		<td class="altbg1" width="15%" bgcolor="#F8F8F8">一个作品是否包含多个图片</td>
		<td class="altbg2" width="85%" align="right" bgcolor="#FFFFFF">
		{if $data[multi]}
		<input type="radio" name="data[multi]" value="1" checked="checked">是
		<input type="radio" name="data[multi]" value="0">否
		{else}
		<input type="radio" name="data[multi]" value="1">是
		<input type="radio" name="data[multi]" value="0" checked="checked">否
		{/if}
		</td>
	</tr>
	<tr>
		<td class="altbg1" width="15%" bgcolor="#F8F8F8">参赛者资料</td>
		<td class="altbg2" width="85%" align="right" bgcolor="#FFFFFF">
			<!--{loop $profile_contest $one}-->
			<input type="checkbox" name="profile[{$one['fieldid']}]">{$one['title']}
			<!--{/loop}-->
		</td>
	</tr>
</table>
<br>
<center><input type="submit" class="button" id="submit" name="addsubmit" value="保 存"></center>
</form>
<script type="text/javascript">
$(document).ready(function(){
	
	$("#submit").click(function(){
		if(!$('[name="time[start_time]"]').val()|| !$('[name="time[end_time]"]').val()){
			return false;
		}
		var start_date = new Date($('[name="time[start_time]"]').val());
		var end_date = new Date($('[name="time[end_time]"]').val());

		if(end_date.valueOf() < start_date.valueOf()){
			alert('结束时间早于开始时间了');
			return false;
		}
	});
});
</script>
